package main.database.entity;

import javax.persistence.*;

/**
 * Created with IntelliJ IDEA.
 * User: Sknictik
 * Date: 28.11.13
 * Time: 3:55
 * To change this template use File | Settings | File Templates.
 */

@Entity
@Table(name = "categories")
public class Category extends MyEntity {

    public static final String NO_CATEGORY_WITH_TAGS = "<html><font color=\"red\">Без категории</font></html>";
    public static final String NO_CATEGORY = "Без категории";
    //TODO set products of category as a part of category as a list. Reason for this is to not execute another query to get all products of category you need to set inverse option to true so that you won't update id twice set this property on product list in category
    @Id@GeneratedValue(strategy=GenerationType.AUTO)
    @Column(name = "id")
    private Long id;

    @Column(name = "name")
    private String name;

    public Category() {
    }

    public Category(long id) {
        this.id = id;
    }

    public Category(String name) {
        this.name = name;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }
}
